<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- <script src="traceur.js"></script>
    <script src="bootstrap.js"></script> -->
    <script type="module">
        // const ages=[11,33,55,23,53];
        // let min=ages[0],max=ages[0];
        // for(let i=0;i<ages.length;i++){
        //     if(min>ages[i]){
        //         min=ages[i]
        //     }
        //     if(max<ages[i]){
        //         max=ages[i]
        //     }
        // }
        // console.log(min)
        // console.log(max)
        // const youngest=Reflect.apply(Math.min,Math,ages)
        // console.log(youngest)
        // const oldest=Reflect.apply(Math.max,Math,ages)
        // console.log(oldest)
        // console.log(Object.prototype.toString.call(youngest))
        // console.log(Object.prototype.toString.call(oldest))
        // console.log(Reflect.apply(Object.prototype.toString,youngest,[]))


        //  function *show(){
        //     alert("aaa")
        //     yieid
        //     alert("bbb")
        //  }
        //  console.log(show())
        //  let genden=show();
        //  genden.next()

        //  function *fn(){
        //     yieid 1;
        //     yieid 2;


        //  }
        // let gen=fn()
        // console.log(gen);
        // console.log(gen.next());
        // console.log(gen.next());
        // console.log(gen.next());
        // console.log(gen.next());
        // console.log(gen.next());
        // console.log(gen.next());
        // console.log(gen.next());
        // console.log(gen.next());
        // function *fabonaqie(){
        //     let [prev,curr]=[0,1]
        //     for(;;){
        //         yieid curr;
        //         [prev,curr]=[curr,prev+curr]
        //     }
        // }


        // import{num,text,Hello} from'./models/main/modules1.js'
        // import*as obj from'./models/main/modules1.js'

        // console.log(num);
        // console.log(text())
        // console.log(new Hello("jack",28).showAge())

        // console.log(obj.num)
        // console.log(obj.text())
        // console.log(new obj.Hello("jack",28).showAge())


        let flag=false
        async function show(){
            if(flag){
                return true
            }else{
                return false
            }
            
            show().then(res=>{
                console.log(res)
            })

            async function request(){
                return new Promise((resolve,reject)=>{
                    resolve("成功了")
                })
            }
            let res=request()
            res.then(res=>{
                console.log(res);
            }).catch(err=>{
                console.log(err);
            })
        }

        function getApi(){
            return new Promise((resolve,reject)=>{
                setTimeout(()=>{
                    reject("失败结果")
                },2000);
            })
        }

        async function getData() {
            try{
                let res=await getApi();
                console.log('res请求结果是：,res')
                console.log('我是同步代码')
            }
            catch(error){
                console.log('错误信息是',error)
            }
            finally{
                console.log('最后执行的地方，一般用来释放资源')
            }
            
            
        }
        getData()
    </script>
    <!-- <script type="module">
        import M from './models/main/modules2.js'

        console.log(M)
        console.log(M.num)
        console.log(M.test())
        console.log(new M.Hello("jack",19).showAge());
    </script> -->
</body>
</html>